package com.zjdiepu.www.commpent.mapper.yw;

import javax.annotation.Resource;

import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.stereotype.Component;

import com.zjdiepu.www.base.core.BaseMapper;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.base.enums.type.InsuredIncomeType;
import com.zjdiepu.www.commpent.RedisObjectClient;
import com.zjdiepu.www.model.base.dto.SimpleDataDictionary;
import com.zjdiepu.www.model.yw.dto.YwFees;
import com.zjdiepu.www.util.CachedEnums;

/**
 * 项目名称：dpqc-parent-manager-information <br/> 
 * 类名称：YwBusinessBuyerVoMapper <br/>  
 * 类描述：按揭日报表<br/>    
 * 创建人：xiongxiaotun <br/> 
 * 创建时间：2017年4月26日 下午1:33:37  <br/>   
 * 修改人：xiongxiaotun <br/> 
 * 修改时间：2017年4月26日 下午1:33:37   <br/>  
 * 修改备注：    <br/> 
 * @version V1.0   <br/>
 */
@Component
public class YwFeesVoMapper extends BaseMapper<YwFees>{
	@Resource
	private RedisObjectClient redisObjectClient;
	@Override
	public void mapper(RedisConnection redisConnection,YwFees m) {
		if(null == m) {
			return;
		}
		
		String rebateType = m.getRebateType();
		SimpleDataDictionary simpleDataDictionary3 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), rebateType, DataDicType.REBATE_TYPE.getCode());
		m.setRebateTypeDisplay(simpleDataDictionary3 == null ? "" : simpleDataDictionary3.getName());
		
		String typeBalance = m.getTypeBalance();
		SimpleDataDictionary simpleDataDictionary4 = redisObjectClient.hGet(redisConnection, SimpleDataDictionary.class.getSimpleName(), typeBalance, DataDicType.SETTLEMENT_TYPE.getCode());
		m.setTypeBalanceDisplay(simpleDataDictionary4 == null ? "" : simpleDataDictionary4.getName());
		
		m.setObjectInsure1((String)CachedEnums.getValue(m.getObjectInsure1(), InsuredIncomeType.class));
		m.setObjectEarnings1((String)CachedEnums.getValue(m.getObjectEarnings1(), InsuredIncomeType.class));
		
		m.setObjectInsure2((String)CachedEnums.getValue(m.getObjectInsure2(), InsuredIncomeType.class));
		m.setObjectEarnings2((String)CachedEnums.getValue(m.getObjectEarnings2(), InsuredIncomeType.class));
		
		m.setObjectInsure3((String)CachedEnums.getValue(m.getObjectInsure3(), InsuredIncomeType.class));
		m.setObjectEarnings3((String)CachedEnums.getValue(m.getObjectEarnings3(), InsuredIncomeType.class));
	}
}
